/**
 * 
 */
package xiaojian.toolkit.transport.closure;

import org.apache.commons.collections4.Closure;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import xiaojian.toolkit.base.Sender;
import xiaojian.toolkit.transport.TransportUtils;


/**
 * @author hp
 *
 */
public class EchoMessageClosure implements Closure<Object> {
	
	private static final Logger logger = LoggerFactory.getLogger(EchoMessageClosure.class);

	/**
	 * @see org.apache.commons.collections.Closure#execute(java.lang.Object)
	 */
	public void execute(Object input) {
		logger.info("try echo:" + input);
		Sender sender = TransportUtils.getSenderOf(input);
		if ( sender != null ) {
			sender.send(input);
		}
	}

}
